﻿using System;
using System.Linq;
using CardPlay.DemoPack.Games.KlondikeVariants;
using CardPlay.Model.CardModel;
using CardPlay.Model.GameModel;
using CardPlay.Model.GameModel.Actions;

namespace CardPlay.DemoPack.Games.YukonVariants
{
    [Game("2CBF360B-3E53-4E30-89AA-6B050F1AF6A5", LevelOfDifficulty.Medium, LevelOfSkill.ModerateSkill, DurationOfPlay.Within5To10Minutes, Family = FamilyName)]
    public class Yukon : Klondike
    {
        public new const string FamilyName = "Yukon";

        public Yukon()
        {
            NamesOfAdditionalPiles.Remove(Waste);
            NamesOfAdditionalPiles.Remove(Stock);
        }

        protected override void PrepareDealScript(DealScript script)
        {
            script.Deal("up").To(Tableau1);

            for (var i = 2; i <= TotalTableaus; ++i)
                script.Deal(String.Concat(Enumerable.Repeat("down;", i - 1)) + "5 up").To(StandardPileNames.PrefixForTableau + i);
        }

        protected override bool AllowedToPickupAtTableau(RemovePileAction action)
        {
            return action.IsActingOnFaceUpTopPile();
        }
    }
}